<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('商品库')" />
	<th:block th:include="include :: businessCSS" />
	<style>
        .preservationBtn{padding: 10px;text-align: center;position: fixed;bottom: 0;width: 95%;background-color: #fff;z-index: 999;text-align: right;}
		.layui-form-item{margin: 0;}
		.preservationBtn input:nth-child(1){font-size: 14px;background-color: rgb(80, 138, 238);color: #fff;border: none;padding: 5px 20px;border-radius: 5px;cursor: pointer;}
		.preservationBtn input:nth-child(2){font-size: 14px;background-color: #fff;color: #999;border: none;padding: 5px 20px;border-radius: 5px;cursor: pointer;border: 1px solid #ddd;}
		.north{margin: 0;}
		.layui-form-label{width: 120px;}
		.layui-input-block{margin-left: 130px;}
		.layui-card-header.layuiadmin-card-header-auto{box-shadow: none;}
		body{background: #fff;}
		.layui-inline{padding: 8px;}
		.layui-inline input{height: 35px;}

	</style>

</head>

<body class="no-skin">
<div class="main-container" id="main-container">
	<div class="main-content">
	<form class="layui-form head-form">
	    <div class="north" style="background-color: #fff;">
			<div class="forminput"></div>
			<!-- <div class="layui-form-item preservationBtn">
				<input type="button" lay-submit lay-filter="btn-add" id="btn-add" value="保存">
			</div> -->
    	</div>
    </form>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<!-- <th:block th:include="include :: inlineJS" /> -->

<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + "hr/operatecompanyratio",
    	prefix2 = ctx + "base/company";
	var	k_fields=[]
	var fields = [[${fields}]];
	var fieldsList = [[${fieldsList}]];
	var fieldsHiddenList = [[${fieldsHiddenList}]];
	var gridColumns= [[${gridColumns}]];
	var all_fields= fieldsList;
	var $,layer,form,table;
    layui.use(['laydate','form','layer','jquery','util','element','upload'], function () {
        $ = layui.$,layer = layui.layer,form = layui.form,laydate = layui.laydate,util = layui.util,element=layui.element,upload = layui.upload;
		headcom()
	    $(".fieldsimg").each(function(){
	    	var id=$(this).attr('name')
            upload.render({
                elem: '#'+id+'_upimg',
	            url: '/system/fileinfo/uploadmailimg',
	            accept: 'images',
	    		before: function(obj){
                    //预读本地文件示例，不支持ie8
                    obj.preview(function(index, file, result){
                      console.log(index, file, result)
                    });
                },
	            done: function (res) {
                    //如果上传失败
                    if (res.errno > 0) {
                        return layer.msg('上传失败');
                    }else{
	    				layer.msg('上传成功');
	    				$('#'+id).val(res.data[0])
	    				layui.$('#'+id+'_upimg').find('.upicon').addClass('layui-hide')
	    				layui.$('#'+id+'_upimg').find('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.data[0]);
	    			}
                },error: function (err) {
                    //演示失败状态，并实现重传
	            	console.log(err)
                }
            });
        })


		$('.t_date').each(function(){
            var datetype=$(this).attr('datetype')
            laydate.render({
				elem:this
                ,type: datetype=='t_date'?'date':datetype=='t_datetime'?'datetime':datetype=='t_year'?'year':'month'
			})
		})


		// beforeInit();//表单初始化之前的动作集合
		// layui.element.render();

    });

	// function getMoreAfter(fieldsList,fields,tindex,fieldName,fieldSearchType,isSearch,isLayer,res){//弹出框赋值回调
	// 	if(fields=="name"){
	// 		$('#name').val(res.name)
	// 		$('#way').val(res.way)
	// 		$('#length').val(res.length)
	// 		$('#width').val(res.width)
	// 		$('#height').val(res.height)
	// 		$('#weight').val(res.weight)
	// 	}else{
	// 		$('#productID').val(res.code)
	// 		$('#productName').val(res.name)
	// 	}
    //     // var fNid=$('#fNid').val()
    //     // $.get("/purchase/purchaseplan/selectPlan?nid="+fNid,function(res){
    //     //     listData1=res.plan
    //     //     listData2=res.planSon
    //     //     table.reload('mjdhtable', {data:listData1});
    //     //     table.reload('zjdhtable', {data:listData2});
	//     // });
    // }

	/*]]>*/
</script>

</body>
</html>